// This is the main DLL file.

#include "stdafx.h"
#include "Fuzzy.h"

namespace Fuzzy 
{
	FFLL::FFLL()
	{
	}

	FFLL::~FFLL()
	{
	}

	int FFLL::fuzzy( int e, int h, int r )
	{
		int		result = -1;
		float	report, hop, energy; // values for input variables
		char	option;	// var for selection of what user wants to do

		// create and load the model
		int model	= ffll_new_model();  
		int ret_val	= ( int )ffll_load_fcl_file( model, "..\\..\\fuzzy.fcl" );

		if (ret_val < 0)
		{
			//cout << "Error Opening aiwisdom.fcl";
			// make sure the "working directory" in "Project | Settings..."
			// is set to the executable's directory if running from the MSVC IDE
			return -2;
		}

		// create a child for the model...
		int child = ffll_new_child( model );

		//while (1)
  //      {
			/*cout << "SELECT AN OPTION:\n\tS - set values\n\tQ - quit";
			cout << endl;
			cin >> option;*/

			option = 'S';

			//if (option == 'Q' || option == 'q')
			//	break;

			if (option == 'S' || option == 's')
            {
				//report	= r;
				//hop		= h;
				//energy	= e;

	            // set input variables...
				ffll_set_value( model, child, REPORT,	r ); 
				ffll_set_value( model, child, HOP,		h );
				ffll_set_value( model, child, ENERGY,	e );
			} // end if option = 's'

            // get and display the output value
			float output = ( float )ffll_get_output_value( model, child );

			return output;


			/*switch(output)
			{
			case 1:
				result = output;
				break;
			case 2:
				result = output;
				break;
			}*/
            
        //}  end while(1)
		
		//return result;
	}
}

